/ Assembly List / LJCNetCommon / XMLBuilder / Begin

Namespace - LJCNetCommon


Parameters
name - The element name.
textState - The current text state values.
attribs - The element attributes.
addIndent - Indicates if the element can be indented.
childIndent - Indicates if the child elements should be indented.

Returns

The added element begin tag.

Syntax

C#
public String Begin(String name, TextState textState, Attributes attribs = null, Boolean addIndent = True, Boolean childIndent = True)

Appends the element begin tag.

Remarks

Begin() is an "Append" method. It creates the element opening tag with GetCreate() and adds it to the builder. The appended text does not end with a new line. This allows for additions after the text.
The added text will start with a new line if the builder text already has a value.

Example

C#
// Root Method Begin
var textState = new TextState();

// Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
var xb = new XMLBuilder(textState);

// Example Method:
var attribs = new Attributes()
{
{ "name", "Someone" },
};
xb.Begin("Person", textState, attribs);

xb.End("Person", textState);
var result = xb.ToString();

// result:
// <Person">
// </Person">

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.